<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
  <h1>Welcome to my website!</h1>
  <button id="login">登录</button>
  <button onclick="location.href='register.html'" id="register">注册</button>

<script src="js/jquery-1.8.2.js"></script>
<script src="js/jquery.cookie.js"></script>
<script>
    $(function(){
        const username = $.cookie('username')
        const name = $.cookie('name')
        if(username){
            if(name){
                $("#login").attr("onclick","location.href='index.html'")
            }else{
                $("#login").attr("onclick","location.href='adminIndex.html'")
            }

        }else{
            $("#login").attr("onclick","location.href='login.html'")
        }
    })
</script>

</body>
</html>